package com.first.orange.service.wangshengwang.impl;

import com.first.orange.beans.*;
import com.first.orange.mapper.*;
import com.first.orange.service.wangshengwang.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created on 2021/7/5.
 * <p>
 * Author: wsw
 * <p>
 * Description:
 */
@Service
public class ProductServiceImpl implements ProductService {

    @Autowired(required = false)
    private ProductMapper productMapper;

    @Autowired(required = false)
    private BrandMapper brandMapper;

    @Autowired(required = false)
    private KindMapper kindMapper;

    @Autowired(required = false)
    private PictureMapper pictureMapper;

    @Autowired(required = false)
    private TasteMapper tasteMapper;

    @Autowired(required = false)
    private PackMapper packMapper;
    /**
     * @author : wsw
     * @date : 2021/7/6
     * @return : int
     * @description :  查询数量
     */
    @Override
    public int queryProductCount(String searchMsg,String brandId, String kindId) {
        return productMapper.selectProductCount(searchMsg,brandId,kindId);
    }
    /**
     * @author : wsw
     * @date : 2021/7/6
     * @return :
     * @description :  查询品牌列表
     */
    @Override
    public List<Brand> queryProductBrand() {
        return brandMapper.selectBrand();
    }
    /**
     * @author : wsw
     * @date : 2021/7/6
     * @return :
     * @description :  查询种类列表
     */
    @Override
    public List<Kind> queryProductKind() {
        return kindMapper.selectkind();
    }
    /**
     * @author : wsw
     * @date : 2021/7/6
     * @return :
     * @description :  查询商品列表
     */
    @Override
    public List<Product> queryProductListByCategory(String searchMsg,String brandId, String kindId,int currPageNo) {
        return productMapper.selectProductByCategory(searchMsg,brandId,kindId,currPageNo);
    }
    /**
     * @author : wsw
     * @date : 2021/7/6
     * @return :
     * @description :  根据productid查询商品图片
     */
    @Override
    public List<Picture> queryProductPictureByProductId(String productId) {
        return pictureMapper.queryPictureByProductId(productId);
    }
    /**
     * @author : wsw
     * @date : 2021/7/6
     * @return :
     * @description :  更具productId查询商品信息
     */
    @Override
    public Product queryProductById(String productId) {
        return productMapper.selectProductById(productId);
    }
    /**
     * @author : wsw
     * @date : 2021/7/6
     * @return : java.util.List<com.first.orange.beans.TasteMapper>
     * @description :  查询口味列表
     */
    @Override
    public List<Taste> queryProductTaste() {
        return tasteMapper.selectTaste();
    }

    @Override
    public List<Pack> queryProductPack() {
        return packMapper.selectPack();
    }


}
